import os
import subprocess
import shutil
import pytest
from config import settings

if __name__ == '__main__':
    if os.path.exists(settings.ALLURE_RESULTS):
        shutil.rmtree(settings.ALLURE_RESULTS)
        if os.path.exists(settings.ALLURE_REPORTS):
            shutil.rmtree(settings.ALLURE_REPORTS)

    pytest.main()
    #
    # # 生成allure测试报告
    # subprocess.call(f"allure generate {settings.ALLURE_RESULTS} -o {settings.ALLURE_REPORTS} --clean", shell=True)
    #
    # # 开打allure测试报告
    # subprocess.call(f"allure open {settings.ALLURE_REPORTS}", shell=True)